﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="FastTravel.IntranetWeb.Login" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>Fast.Travel - вход в систему</title>
	<script type="text/javascript" language="javascript">
		var enterKeyPressHandler = function (f, e) {
			if (e.getKey() == e.ENTER) {
				Ext.net.DirectMethods.LoginAction();
				e.stopEvent();
			}
		}
   </script>
</head>
<body>
	<form id="formLogin" runat="server">
		<ext:ResourceManager runat="server" ID="resourceManager" Theme="Gray" />
		<ext:Window  ID="LoginWindow"  runat="server"  Closable="false"  Resizable="false" Height="150" Icon="Lock" Title="Вход в систему"  Draggable="true" Width="350"  Modal="true" Layout="fit" BodyBorder="false" Padding="5" >
		<Items>
				<ext:FormPanel ID="pnlLogin" runat="server" FormID="formPnlLogin"  Border="false" Layout="form" BodyBorder="false" BodyStyle="background:transparent;">
					<Items>
						 <ext:TextField ID="txtUsername" runat="server" FieldLabel="Пользователь" AllowBlank="false" BlankText="Укажите имя пользователя." Text="admin"  AnchorHorizontal="100%" SelectOnFocus="true"/>
						 <ext:TextField ID="txtPassword" runat="server" InputType="Password" FieldLabel="Пароль" AllowBlank="false" BlankText="Укажите пароль." Text="admin" AnchorHorizontal="100%" SelectOnFocus="true">
							<Listeners>
								<SpecialKey Fn="enterKeyPressHandler" />
							</Listeners>
						 </ext:TextField>
					</Items>
				</ext:FormPanel>
		</Items>
	   <Buttons>
				<ext:Button ID="btnLogin" runat="server" Text="Вход" Icon="Accept">
					<Listeners>
						<Click Handler="
							if (!#{txtUsername}.validate() || !#{txtPassword}.validate()) {
								Ext.Msg.alert('Ошибка','Укажите имя пользователя и пароль!');
								// return false to prevent the btnLogin_Click Ajax Click event from firing.
								return false; 
							}" />
					</Listeners>
					<DirectEvents>
						<Click OnEvent="BtnLoginClick">
							<EventMask ShowMask="true" Msg="Проверка..." MinDelay="500" />
						</Click>
					</DirectEvents>
				</ext:Button>
			</Buttons>
	</ext:Window>
	</form>
</body>
</html>
